#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e5 + 10;
int arr[N];
int n;
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	int t = n - 1;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += t * arr[i];
		t--;
	}
	cout << ans << endl;
	return 0;
}